package com.summer.safe.system.service;


import com.summer.safe.system.dao.AreaDao;
import com.summer.safe.utils.UserUtils;
import com.summer.safe.system.entity.Area;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 区域Service
 *
 *
 */
@Service
@Transactional(readOnly = true)
public class AreaService extends TreeService<AreaDao, Area> {
    public List<Area> findAll() {
        return UserUtils.getAreaList();
    }

    public List<Area> findList(Boolean isAll) {
        if (isAll != null && isAll) {
            return UserUtils.getAreaAllList();
        } else {
            return UserUtils.getAreaList();
        }
    }

    @Override
    @Transactional(readOnly = true)
    public List<Area> findList(Area area) {
        return dao.findList(area);
    }

    @Override
    @Transactional(readOnly = false)
    public void save(Area area) {
        super.save(area);
    }

    @Override
    @Transactional(readOnly = false)
    public void delete(Area area) {
        super.delete(area);
    }

}
